<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/6/21
  Time: 21:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>问题与解答</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- All Plugins Css -->
    <link href="assets/css/plugins.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="assets/css/styles.css" rel="stylesheet">

    <script src="assets/js/search.js"></script>
    <script src="assets/js/wangEditor.min.js"></script><!-- 富文本导包 -->
    <script type="text/javascript">
        var msg = "${msg}"
        if(msg!=""){
            alert(msg)
        }
    </script>
</head>

<body class="blue-skin">
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->
<div class="Loader"></div>

<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<div id="main-wrapper">

    <!-- ============================================================== -->
    <!-- Top header  -->
    <!-- ============================================================== -->
    <!-- Start Navigation -->
    <div class="header header-light">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12">
                    <nav id="navigation" class="navigation navigation-landscape">
                        <div class="nav-header">
                            <a class="nav-brand" href="#">
                                <img src="assets/img/logo3.png" class="logo" alt="" />
                            </a>
                            <div class="nav-toggle"></div>
                        </div>
                        <div class="nav-menus-wrapper">
                            <ul class="nav-menu">

                                <li><a href="jump/toindex">主页<span class="submenu-indicator"></span></a>
                                </li>

                                <li><a href="jump/tostudy">学习主题<span class="submenu-indicator"></span></a>
                                    <ul class="nav-dropdown nav-submenu">
                                        <c:forEach items="${slist}" var="s">
                                            <li><a href="jump/${s.surl}">${s.sname}</a></li>
                                        </c:forEach>
                                    </ul>
                                </li>
                                <li><a href="jump/toarticles">精品文章</a></li>
                                <li class="active"><a href="jump/tofaq">问题与解答</a></li>
                                <li><a href="jump/toteacher">金牌讲师<span class="submenu-indicator"></span></a>
                                    <ul class="nav-dropdown nav-submenu">
                                        <li><a href="jump/toteacher">mxt</a></li>
                                    </ul>
                                </li>
                                <li><a href="jump/touser">其他<span class="submenu-indicator"></span></a>
                                    <ul class="nav-dropdown nav-submenu">
                                        <li><a href="jump/tologin">登录</a></li>
                                        <li><a href="jump/tosignup">注册</a></li>
                                        <li><a href="jump/towallets">数据表</a></li>
                                        <li><a href="jump/touser">个人信息</a></li>
                                        <li><a href="index/logout/${jump}">退出登录</a> </li>
                                    </ul>
                                </li>
                            </ul>
                            <jsp:include page="denglu.jsp"/>
                        </div>
                    </nav>
                </div>
            </div>
        </div>
    </div>
    <!-- End Navigation -->
    <div class="clearfix"></div>
    <!-- ============================================================== -->
    <!-- Top header  -->
    <!-- ============================================================== -->

    <!-- ============================ Header Start================================== -->
    <div class="_agt_dash dark" style="background:#675bca url(assets/img/tag-light.png) no-repeat;">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12">
                    <div class="_capt9oi">
                        <h1 class="text-light">问题与解答</h1>
                    </div>
<%--                    搜索框--%>
                    <div class="row justify-content-center">
                        <div class="col-lg-8 col-md-10 col-sm-12">
                            <div class="banner-search style-1">
                                <div class="input-group">
                                    <div class="input-group-append hime_m">
                                        <div class="form-group b-r">
                                            <select id="category" class="js-states form-control">
                                                <option value=""></option>
                                                <option value="根据提问人搜索">根据提问人搜索</option>
                                                <c:forEach items="${slist}" var="s">
                                                    <option value="${s.sid}">${s.sname}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                    <input type="text" class="form-control lio-rad" placeholder="搜索问题标题" onkeyup="searchTitle(this)">
                                    <div class="input-group-append">
                                        <button type="button" class="btn bt-round"><i class="ti-search"></i></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- ========================== Header header ============================= -->



    <!-- ========================== FAQ's Elements ============================= -->


    <section>
        <div class="container">
            <div class="row">
                <div class="col-lg-10 col-md-12 col-sm-12">
                    <div class="_faqs9oi87">
                        <div id="question">
                        <!-- Single -->
                        <c:forEach items="${qlist}" var="q">
                            <div class="_sin98ufaq">
                                <h4>${q.qtext}<span style="float: right">
                                    <c:set var="flag" scope="page" value="1"/>
                                    <c:if test="${clist!=null}">
                                        <c:forEach items="${clist}" var="c">
                                            <c:if test="${q.qid==c.qid.qid && user.uid==c.uid.uid}">
                                                <c:set var="flag" scope="page" value="2"/>
                                                已收藏
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                    <c:if test="${clist!=null}">
                                    <c:forEach items="${clist}" var="c">
                                        <c:if test="${flag==1}">
                                            <c:set var="flag" scope="page" value="2"/>
                                            <c:if test="${q.qid!=c.qid.qid || user.uid!=c.uid.uid}">
                                                <a href="faq/collect/${q.qid}/${index}">收藏</a>
                                            </c:if>
                                        </c:if>
                                    </c:forEach>
                                    </c:if>
                                    <c:if test="${flag==1}">
                                            <c:set var="flag" scope="page" value="2"/>
                                    <c:if test="${user!=null}">
                                        <a href="faq/collect/${q.qid}/${index}">收藏</a>
                                    </c:if>
                                    </c:if>
                                <a id="${q.qid-44444}" href="javascript:void(0)" displayname="${q.qid-99999}" displayname2="${q.qid-33333}" onclick="showAnswer(this)" hidden="hidden">显示</a>
                                    <a id="${q.qid-33333}" href="javascript:void(0)" displayname="${q.qid-99999}" displayname2="${q.qid-44444}" onclick="hiddenAnswer(this)">隐藏</a>
                                </span></h4>
                                <h4 align="right">语言：${q.sid.sname}。提问人：${q.uid.uname}</h4>
                                <c:if test="${user.uid == q.uid.uid && user.uid != 1}">
                                    <a href="javascript:void(0);" style="color: red;float: right" class="liks light-dark" displayname="${q.qid}" onclick="deleteReview(this)">删除问题</a>
                                </c:if>
                                <c:if test="${user.uid==1}"><!-- 判断是否为管理员账号 -->
                                <a href="javascript:void(0);" style="color: red;float:right;" class="liks light-dark" displayname="${q.qid}" onclick="deleteReview(this)">删除问题</a>
                                </c:if>
                                <div id="${q.qid-99999}">
                                <c:forEach items="${alist}" var="a">
                                    <c:if test="${q.qid==a.qid}">
                                        <br/><p>${a.ttext}</p><span style="float: right">回答人：${a.uid.uname}。时间：${a.tsend}
                                    <c:if test="${user.uid == q.uid.uid && user.uid != 1}">
                                        <a href="javascript:void(0);" style="color: red" class="liks light-dark" displayname="${a.tid}" onclick="deleteAnswer(this)">删除回答</a>
                                    </c:if>
                                        <c:if test="${user.uid==1}"><!-- 判断是否为管理员账号 -->
                                            <a href="javascript:void(0);" style="color: red" class="liks light-dark" displayname="${a.tid}" onclick="deleteAnswer(this)">删除回答</a>
                                        </c:if>
                                    </span>
                                    </c:if>
                                </c:forEach>
                                </div>
                                <br/>
                                <div style="float: right"><a href="javascript:void(0);" style="color: red"
                                                             class="liks light-dark" displayname="${q.qid}" onclick="showReview(this)">回答问题/评论</a></div>
                                <div id="${q.qid}" hidden="hidden">
                                    <form action="faq/answerQuestion" method="post">
                                        <textarea rows="6" cols="75" placeholder="请输入您的答案" id="${q.qid}" name="text"></textarea>
<%--                                        <input type="text" id="${q.qid}" name="text" style="width: 860px;height: 400px"/>--%>
                                        <input type="hidden" name="qid" value="${q.qid}"/>
                                        <br/>
                                        <input type="submit" value="确定提交">
                                    </form>
                                </div>
                            </div>
                        </c:forEach>
                        </div>
                        <input type="hidden" id="uid" value="${user.uid}"/>
<br/>
                        <div>

                        当前页【${index2 }】，总页数【${pagecount2 }】&nbsp;&nbsp;<a
                            href="faq/page/1" class="link link_prview">首页</a>&nbsp;&nbsp;

                        <c:if test="${index<=1 }">
                            没有上一页
                        </c:if>
                        <c:if test="${index>1 }">
                            <a href="faq/page/${index-1 }" class="link link_prview">上一页</a>
                        </c:if>
                        &nbsp;&nbsp;
                        <c:if test="${index>=pagecount }">
                            没有下一页
                        </c:if>
                        <c:if test="${index<pagecount }">
                            <a href="faq/page/${index+1 }" class="link link_prview">下一页</a>
                        </c:if>
                        &nbsp;&nbsp; <a href="faq/page/${pagecount }" class="link link_prview">尾页</a>&nbsp;&nbsp;
                        跳转至：<select onchange="location='faq/page/'+this.value">
                        <c:forEach begin="1" end="${pagecount }" step="1" var="i">
                            <option value="${i }" <c:if test="${index==i }" >selected</c:if>>第${i }页
                            </option>
                        </c:forEach>
                        </select>
                            &nbsp;&nbsp;总共有${count}条&nbsp;&nbsp;一页显示6条
                        </div>

                        <label class="container">请输入您要发布的问题<span style="float: right">语言选择：
                            <select id="language" class="js-states">
                                                <c:forEach items="${slist}" var="s">
                                                    <option value="${s.sid}">${s.sname}</option>
                                                </c:forEach>
                                            </select></span></label>
                        <div id="div1" style="width: 940px"></div>
                        <div class="urip_follo_link">
                            <ul>
                                <li><a href="javascript:void(0);" class="liks light-dark" onclick="futext()">确认发布</a></li>
                            </ul>
                        </div>
                        <!-- 引入 wangEditor.min.js -->
                        <script type="text/javascript">
                            const E = window.wangEditor
                            const editor = new E('#div1')
                            //或者 const editor = new E( document.getElementById('div1') )
                            editor.create()
                        </script>
<%--                            <div class="uhtro">--%>
<%--                                <ul class="m-0">--%>
<%--                                    <li>Sed ut perspiciatis unde omnis iste natus error sit</li>--%>
<%--                                    <li>Gvoluptatem doloremque laudantium nostrum</li>--%>
<%--                                    <li>Ut enim ad minima veniam, quis nostrum</li>--%>
<%--                                    <li>who do not know how to pursue pleasure</li>--%>
<%--                                    <li>15 Days Rfund Policy</li>--%>
<%--                                    <li>24x7 Full Support</li>--%>
<%--                                </ul>--%>
<%--                            </div>--%>

                    </div>



                </div>
            </div>
        </div>
    </section>
    <!-- ========================== FAQ's Elements ============================= -->

    <!-- =========================== Footer Start ========================================= -->
    <jsp:include page="footer.jsp"></jsp:include>
    <!-- =========================== Footer End ========================================= -->

    <!-- Log In Modal -->
    <!-- End Modal -->

</div>
<!-- ============================================================== -->
<!-- End Wrapper -->
<!-- ============================================================== -->

<!-- ============================================================== -->
<!-- All Jquery -->
<!-- ============================================================== -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/select2.min.js"></script>
<script src="assets/js/owl.carousel.min.js"></script>
<script src="assets/js/ion.rangeSlider.min.js"></script>
<script src="assets/js/counterup.min.js"></script>
<script src="assets/js/custom.js"></script>
<!-- ============================================================== -->
<!-- This page plugins -->
<!-- ============================================================== -->

<script>
    function openRightMenu() {
        document.getElementById("rightMenu").style.display = "block";
    }
    function closeRightMenu() {
        document.getElementById("rightMenu").style.display = "none";
    }
</script>

</body>
</html>